package com.huajin.codetest.collection;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class StringToListTest {
	
	public static void main(String[] args) {
		String ids = "1,2,3,4";
		List<Integer> collect4 = Arrays.asList(ids.split(",")).stream().collect(Collectors.mapping(Integer::valueOf, Collectors.toList()));
		System.out.println(collect4);
		List<Integer> collect2 = Arrays.stream(ids.split(",")).collect(Collectors.mapping(Integer::valueOf, Collectors.toList()));
		System.out.println(collect2);
		List<Integer> collect =  List.of(ids.split(",")).stream().collect(Collectors.mapping(Integer::valueOf, Collectors.toList()));
		System.out.println(collect);
		List<Integer> collect3 = Stream.of(ids.split(",")).collect(Collectors.mapping(Integer::valueOf, Collectors.toList()));
		System.out.println(collect3);
	}

}
